import { ApiProperty } from '@nestjs/swagger';
import { Column, Entity } from 'typeorm';
import { BaseEntity } from '../../../base.entity';

@Entity({ name: 'wip_order_report' })
export default class WipOrderReport extends BaseEntity {
  @Column({ type: 'varchar', length: 50, name: 'report_code', unique: true, comment: '报工编号' })
  @ApiProperty()
  reportCode: string;

  @Column({ type: 'varchar', length: 50, name: 'order_code', comment: '工单编号' })
  @ApiProperty()
  orderCode: string;

  @Column({ type: 'varchar', length: 50, name: 'machine_code', comment: '设备编号' })
  @ApiProperty()
  machineCode: string;

  @Column({ type: 'float', name: 'report_num', comment: '报工数' })
  @ApiProperty()
  reportNum: number;

  @Column({ type: 'varchar', name: 'shift_code', comment: '班组编号' })
  @ApiProperty()
  shiftCode: string;

  @Column({ type: 'varchar', name: 'material_code', comment: '产品编号' })
  @ApiProperty()
  materialCode: string;

  @Column({ type: 'varchar', length: 50, name: 'material_name', comment: '产品名称' })
  @ApiProperty()
  materialName: string;

  @Column({ type: 'varchar', nullable: true, comment: '版本' })
  @ApiProperty()
  version: string;

  @Column({ type: 'varchar', name: 'report_user_list', comment: '上工人员' })
  @ApiProperty()
  reportUserList: string;

  @Column({ type: 'float', name: 'report_status', default: 0, comment: '报工状态' })
  @ApiProperty()
  reportStatus: number;

  @Column({ type: 'float', name: 'report_finish_status', default: 0, comment: '报工完成状态' })
  @ApiProperty()
  reportFinishStatus: number;

  @Column({ type: 'float', name: 'report_confirm_num', nullable: true, comment: '确认数' })
  @ApiProperty()
  reportConfirmNum: number;

  @Column({ type: 'float', name: 'good_num', nullable: true, comment: '良品数' })
  @ApiProperty()
  goodNum: number;

  @Column({ type: 'float', name: 'bad_num', nullable: true, comment: '不良数' })
  @ApiProperty()
  badNum: number;

  @Column({ type: 'datetime', name: 'report_time', comment: '报工时间' })
  @ApiProperty()
  reportTime: Date;

  @Column({ type: 'varchar', nullable: true, comment: '备注' })
  @ApiProperty()
  remark: string;

  @Column({ type: 'float', name: 'erp_no', nullable: true, comment: '第三方订单编号' })
  @ApiProperty()
  erpNo: string;

  @Column({ type: 'float', name: 'electricity_consumption', nullable: true, comment: '用电量' })
  @ApiProperty()
  electricityConsumption: number;

  @Column({ type: 'float', name: 'water_consumption', nullable: true, comment: '用水量' })
  @ApiProperty()
  waterConsumption: number;

  @Column({ type: 'float', name: 'electricity_bill', nullable: true, comment: '电费' })
  @ApiProperty()
  electricityBill: number;

  @Column({ type: 'float', name: 'water_bill', nullable: true, comment: '水费' })
  @ApiProperty()
  waterBill: number;

  @Column({ type: 'float', name: 'ink_usage', nullable: true, comment: '水墨总用量' })
  @ApiProperty()
  inkUsage: number;

  @Column({ type: 'float', name: 'labor_cost', nullable: true, comment: '人工费' })
  @ApiProperty()
  laborCost: number;

  @Column({ type: 'float', name: 'material_cost', nullable: true, comment: '材料成本' })
  @ApiProperty()
  materialCost: number;

  @Column({
    type: 'float',
    name: 'variable_manufacture_cost',
    nullable: true,
    comment: '变动制造成本',
  })
  @ApiProperty()
  variableManufactureCost: number;

  @Column({ type: 'float', name: 'adjuest_num', default: 0, comment: '调机数' })
  @ApiProperty()
  adjuestNum: number;

  @Column({
    type: 'datetime',
    nullable: true,
    name: 'adjuest_success_time',
    comment: '调机成功时间',
  })
  @ApiProperty()
  adjuestSuccessTime: Date;

  @Column({
    type: 'float',
    nullable: true,
    name: 'adjuest_duration',
    comment: '调机时长',
  })
  @ApiProperty()
  adjuestDuration: number;
}
